package com.buyhouse.zhaimao.adapter;

import java.util.List;

import com.buyhouse.zhaimao.R;
import com.buyhouse.zhaimao.view.CircleImageView;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

/**
 * @author wr
 *
 */
public class CommunityShaiAdapter extends BaseAdapter {
	
	private List<String> data;
	private LayoutInflater inflater;
	private Context context;
	private int i=0;
	
	public CommunityShaiAdapter(List<String> data, Context context,int i) {
		super();
		this.data = data;
		this.context=context;
		this.i=i;
		this.inflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		return data.size();
	}

	@Override
	public Object getItem(int position) {
		return data.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		Holder holder;
		if(convertView==null){
			holder=new Holder();
			convertView=inflater.inflate(R.layout.item_community_sort, null);
			holder.mTv=(TextView) convertView.findViewById(R.id.item_sort_tv);
			
			convertView.setTag(holder);
		}else{
			holder=(Holder) convertView.getTag();
		}
		
		holder.mTv.setText(data.get(position));		
		//开启记录功能
//		if (position == i) {
//			holder.mTv.setTextColor(context.getResources().getColor(R.color.top_bar_color));
//		}else {
//			holder.mTv.setTextColor(context.getResources().getColor(R.color.pf_item_name_color));
//		}
		return convertView;
	}
	
	class Holder{
		TextView mTv;		
	}
	

}
